package com.example.winner.xmldesign;

import android.support.v7.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
 * Created by winner on 2018/6/4.
 */

public class Result extends AppCompatActivity{
    private Intent intent;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.result);
        Bundle bundle = this.getIntent().getExtras();
        String answer = bundle.getString("answer");
        String sexText;
        if (answer.equals("in")) {
            sexText = "正确";
        } else {
            sexText = "错误";
        }
        TextView tv1 = (TextView) findViewById(R.id.text);
        tv1.setText("您选择的答案是：" + sexText+"的");
        Button back = (Button) findViewById(R.id.back);
        back.setOnClickListener(new Button.OnClickListener() {
            @Override
            public void onClick(View view) {
                // TODO Auto-generated method stub
			/* 返回result 回上一个activity */
                Result.this.setResult(RESULT_OK,intent);
			/* 结束这个activity */
                Result.this.finish();
            }
        });
    }
}
